﻿using Tesseract;

namespace TextExtractionMaster.Extractor
{
    public class ImageTextExtractor : ITextExtractor
    {
        public string ExtractText(string filePath)
        {
            using (var engine = new TesseractEngine(@"./tessdata", "chi_sim", EngineMode.Default))
            {
                using (var img = Pix.LoadFromFile(filePath))
                {
                    using (var page = engine.Process(img))
                    {
                        return page.GetText();
                    }
                }
            }

        }
    }

}
